<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php //echo $title?></title>
<?php echo $header;?>
<script type="text/javascript" src="<?php echo base_url('js/ajaxfileupload.js');?>"></script>
<script>
$(document).ready(function(){
	$("#s_upload").click(function(){
		$("#upload_loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});
		
		var callBackInput = '<?php echo $input;?>';
		var allowed = '<?php echo $type;?>';
		var url = '<?php echo base_url('upload/upload_action');?>';
		$.ajaxFileUpload 
		({
				url:url,
				secureuri:false,
				fileElementId:'file_upload',
				dataType: 'json',
				data:{upload_type:allowed,form_name:'file_upload'},
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							$.dialog.alert(data.error);
							
						}else
						{
							var origin = artDialog.open.origin;
							var aValue = data.data;
							var input = origin.document.getElementById(callBackInput);
							input.value = aValue;
							//input.select();
							$.dialog.close();							
						}
					}
				},
				error: function (data, status, e)
				{
					$.dialog.alert('系统错误');
				}
		})
		return false;
	});
});
</script>
</head>
<body>
<img id="upload_loading" src="<?php echo base_url('images/loading.gif');?>" style="display:none;" />
<form name="form" action="" method="post" enctype="multipart/form-data">
<table align="center" cellpadding="0" cellspacing="0" class="tableForm">
	<tr>
		<td><?php echo lang('upload_choise_file');?>&nbsp;<input id="file_upload" type="file" size="30" name="file_upload" class="input"></td></tr>
		<tr>
			<td><button class="button" id="s_upload" ><?php echo lang('com_button_upload');?></button></td>
		</tr>
</table>
</form>    	
</body>
</html>
